Skip to content

fix(cold-store-reaper): retry D1 sync statements that D1 throttles - #12084

Merged
dezren39 merged 1 commit into
mainfrom
fix/cold-store-d1-sync-retry
Nov 20, 2026
Merged

dezren39 merged 1 commit into
mainfrom
fix/cold-store-d1-sync-retry

Conversation

@dezren39

@dezren39 dezren39 commented Nov 20, 2026 •

Copy link
Copy Markdown
Member

Before: one HTTP 429 from D1 ("Your account is generating too much load on D1 DBs") in the middle of the nightly manifest sync failed the whole sync-manifest step. That happened on Nov 19 at 05:01 CT, on the 47-statement sync, while the account was far below its D1 limits (about 300 queries an hour that morning, about 1.8 M rows written in the last 31 days).

After: a throttled statement is sent again after a pause, and the sync finishes.

sync_manifest retries a statement answered with 429 or 503, up to 5 attempts in all, waiting Retry-After (capped at 30 s) or 2 s × attempt. Every sync statement is an idempotent upsert, so a resend is safe. Any other error still fails at once, and the last throttled answer still fails with D1's own message. The result now reports how many retries ran.

How: _d1_sync_post and _d1_retry_delay in cold_store.py; FakeD1 can now throttle. New tests cover a retried 429, a retried 503, giving up after the last attempt, Retry-After with its cap, and no retry on a 500. tests.test_cold_store, tests.test_nightly_backup and tests.test_export_turso pass locally (189 tests).


Generated by Claude Code


Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

On Nov 19 one HTTP 429 ("Your account is generating too much load on
D1 DBs") in the middle of a 47-statement sync failed the nightly
sync-manifest step, though the account was far below its D1 limits.

sync_manifest now sends a statement again after a 429 or 503, up to
5 attempts, waiting Retry-After (capped at 30 s) or 2 s x attempt.
Every statement is an idempotent upsert, so a resend is safe. Other
errors still fail at once. The result reports how many retries ran.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Nov 20, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@dezren39
dezren39 marked this pull request as ready for review November 20, 2026 01:45
@dezren39
dezren39 requested a review from a team as a code owner November 20, 2026 01:45
@dezren39
dezren39 merged commit fa487df into main Nov 20, 2026
@dezren39
dezren39 deleted the fix/cold-store-d1-sync-retry branch November 20, 2026 01:45
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T01:47:02.515979Z f2a759e Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants